package com.example.douyin.cons;

import androidx.lifecycle.MutableLiveData;

import com.example.lib_base_mvvm.baseMVVM.BaseRepo.BaseRepo;
import com.hyphenate.chat.EMConversation;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

public class ConsRepo extends BaseRepo {

    public void cons(MutableLiveData<List<EMConversation>> success,MutableLiveData<String> fail){
        Map<String, EMConversation> conversations = emClient.chatManager().getAllConversations();
        if(conversations.size()<0){
            //获取失败
            fail.postValue("获取失败");
        }else{
            List<EMConversation> cons = new ArrayList<>();
            cons.addAll(conversations.values());
            success.postValue(cons);
        }

    }

}
